package common.project.epic.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class EpicRTOpenHelper extends SQLiteOpenHelper {

	private static final String DB_NAME = "epicRunTimeDb";
	private static final int DB_VERSION = 1;
	
	public EpicRTOpenHelper(Context context) {
		super(context, DB_NAME, null, DB_VERSION);
		
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		
		//tabella in cui inserisco i dispositivi trovati durante la fase di inquiry
		String devicesRT = "CREATE TABLE devicesRT (mac INTEGER PRIMARY KEY NOT NULL  UNIQUE , name TEXT NOT NULL, rssi REAL NOT NULL, discovered_at NUMERIC NOT  NULL);";
		db.execSQL(devicesRT);
		
		//tabella dei MAC address in blacklist a cui non invio fino al tempo indicato in timestamp
		String devicesBL = "CREATE TABLE devicesRT (mac INTEGER PRIMARY KEY NOT NULL  UNIQUE , timestamp TEXT NOT NULL , description VARCHAR);";
		db.execSQL(devicesBL);
		
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		// TODO metodo da implementare ogni qualvolta viene rilasciata una versione nuova del software
		
		

	}

}
